<template>
  <div class="global-bases">
    <section class="content-section">
      <div class="container">
        <div class="grid lg:grid-cols-3 gap-8">
          <div v-for="item in items" :key="item.company">
            <div class="card">
              <div class="card-image">
                <img :src="item.imageSrc" alt="Card Image" class="image">
              </div>
              <div class="card-content">
                <div class="location">
                  <span class="city">{{ $t(`globalbases.${item.city}`) }}</span>
                  <span class="company">{{ $t(`globalbases.${item.company}`) }}</span>
                </div>
                <p class="card-description">
                  <span class="label">{{ $t('globalbases.Label') }}</span>
                  {{ $t(`globalbases.${item.address}`) }}
                </p>
              </div>
            </div>
          </div>
        </div>
      </div>
    </section>
  </div>
</template>

<script>
export default {
  name: 'GlobalBases',
  data() {
    return {
      Label: 'Label',
      items: [
        {
          city: 'USA',
          company: 'MBC',
          address: 'MBCAddress',
          imageSrc: require('@/assets/bases/MBC BioLabs.png')
        },
        {
          city: 'UK',
          company: 'Cambridge',
          address: 'CambridgeAddress',
          imageSrc: require('@/assets/bases/jianqiao.png')
        },
        {
          city: 'CH',
          company: 'BioAlps',
          address: 'BioAlpsAddress',
          imageSrc: require('@/assets/bases/BioAlps.png')
        },
        {
          city: 'HK',
          company: 'chuangxin',
          address: 'chuangxinAddress',
          imageSrc: require('@/assets/bases/chuangkeyuan.png')
        },
        {
          city: 'HK',
          company: 'kejiyuan',
          address: 'kejiyuanAddress',
          imageSrc: require('@/assets/bases/kejiyuan.png')
        },
        {
          city: 'GD',
          company: 'yigu',
          address: 'yiguAddress',
          imageSrc: require('@/assets/bases/guangdongyigu.png')
        },
        {
          city: 'GD',
          company: 'shenzhen',
          address: 'shenzhenAddress',
          imageSrc: require('@/assets/bases/shenzhen.png')
        },
        {
          city: 'GD',
          company: 'guigu',
          address: 'guiguAddress',
          imageSrc: require('@/assets/bases/guigu.png')
        },
        {
          city: 'GD',
          company: 'xietong',
          address: 'xietongAddress',
          imageSrc: require('@/assets/bases/jingguangxietong.png')
        },
      ]
    };
  }
};
</script>

<style scoped>

.global-bases {
  font-family: Arial, sans-serif;
}

.content-section {
  width: 100%;
  padding: 3% 8% 0 10%; /* 保持上下内边距，左右内边距增加 */
}

.container {
  max-width: 100vw; /* 占满父元素宽度 */
  padding: 0;
  margin: 0 auto; /* 保持居中 */
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr); /* 固定三列 */
  gap: 2%; /* 网格间距 */
}

.card {
  display: flex;
  flex-direction: column;
  background-color: #f3f4f6;
  color: #1f2937;
  width: 90%;
  height: 90%;
  top: 2%;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
  transform: translateY(-10px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.card-image {
  height: 70%;
}

.card-image .image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-content {
  padding: 1rem;
}

.location {
  display: flex;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 1vw;
}

.city {
  background-color: #f8c38d;
  color: #000000;
  padding: 0.1rem 0.3rem;
  margin-right: 0.5rem;
  border-radius: 0.4rem;
  font-size: 0.9vw; /* 保持字体大小 */
}

.company {
  font-weight: bold;
  font-size: 1vw;
}

.label {
  font-size: 0.9vw;
  color: #ffab5e;
}

.card-description {
  font-size: 0.9vw;
}

@media (max-width: 768px) {
  .grid {
    grid-template-columns: repeat(3, 1fr); /* 保持三列 */
    gap: 1.5rem; /* 调整小屏幕上的网格间距 */
  }
}

@media (max-width: 480px) {
  .location {
    font-size: 10px; /* 调整字体大小 */
  }

  .city {
    font-size: 10px; /* 调整字体大小 */
    padding: 0.1rem 0.2rem; /* 调整内边距 */
  }

  .company {
    font-size: 12px; /* 调整字体大小 */
  }

  .card-description {
    font-size: 8px; /* 调整字体大小 */
  }
}

</style>
